/*
 * LipikaEngine is a multi-codepoint, user-configurable, phonetic, Transliteration Engine.
 * Copyright (C) 2018 Ranganath Atreya
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */

import Foundation

/// This class provides default config values that the client can override, typically using `UserDefaults` and pass an instance into `LiteratorFactory`.
open class Config {
    /**
     Empty public init to enable clients to call super.init()
     */
    public init() {}
    
    /**
     This character is used to break input aggregation. Typically this is the forward-slash character (`\`).
     
     __Example__: if `a` maps to `1` and `b` maps to `2` and `ab` maps to `3` then inputting `ab` will output `3` but inputting `a\b` will output `12`
     */
    open var stopCharacter: UnicodeScalar { return "\\" }

    /**
     All input characters enclosed by this character will be echoed to the output as-is and not converted.
     
     __Example__: if `a` maps to `1` and `b` maps to `2` and `ab` maps to `3` then inputting `ab` will output `3` but inputting `` `ab` `` will output `ab`
     */
    open var escapeCharacter: UnicodeScalar { return "`" }
    
    /**
     The URL path to the top-level directory where the schemes files are present. Usually this would return something like `Bundle.main.bundleURL.appendingPathComponent("Mapping")`
     */
    open var mappingDirectory: URL { return Bundle(for: Config.self).bundleURL.appendingPathComponent("Resources", isDirectory: true).appendingPathComponent("Mapping", isDirectory: true) }
    
    /**
     The level at which to NSLog log messages generated by LipikaEngine.
     
     - Important: This configuration only holds within the same thread in which `LiteratorFactory` was initialized.
     */
    open var logLevel: Logger.Level { return .warning }
}
